using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._DataManagementTools._JoinsandRelates
{
    /// <summary>
    /// <para>Join Field</para>
    /// <para>Joins the contents of a table to another table based on a common attribute field. The input table is updated to contain the fields from the join table. You can select which fields from the join table will be added to the input table.</para>
    /// <para>基于公共属性字段将表的内容联接到另一个表。输入表将更新为包含连接表中的字段。您可以选择将连接表中的哪些字段添加到输入表中。</para>
    /// </summary>    
    [DisplayName("Join Field")]
    public class JoinField : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public JoinField()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_data">
        /// <para>Input Table</para>
        /// <para>The table or feature class to which the join table will be joined.</para>
        /// <para>连接表将连接到的表或要素类。</para>
        /// </param>
        /// <param name="_in_field">
        /// <para>Input Join Field</para>
        /// <para>The field in the input table on which the join will be based.</para>
        /// <para>输入表中连接所基于的字段。</para>
        /// </param>
        /// <param name="_join_table">
        /// <para>Join Table</para>
        /// <para>The table to be joined to the input table.</para>
        /// <para>要联接到输入表的表。</para>
        /// </param>
        /// <param name="_join_field">
        /// <para>Join Table Field</para>
        /// <para>The field in the join table that contains the values on which the join will be based.</para>
        /// <para>连接表中包含连接所基于的值的字段。</para>
        /// </param>
        public JoinField(object _in_data, object _in_field, object _join_table, object _join_field)
        {
            this._in_data = _in_data;
            this._in_field = _in_field;
            this._join_table = _join_table;
            this._join_field = _join_field;
        }
        public override string ToolboxName => "Data Management Tools";

        public override string ToolName => "Join Field";

        public override string CallName => "management.JoinField";

        public override List<string> AcceptEnvironments => ["autoCommit", "workspace"];

        public override object[] ParameterInfo => [_in_data, _in_field, _join_table, _join_field, _fields, _out_layer_or_view];

        /// <summary>
        /// <para>Input Table</para>
        /// <para>The table or feature class to which the join table will be joined.</para>
        /// <para>连接表将连接到的表或要素类。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_data { get; set; }


        /// <summary>
        /// <para>Input Join Field</para>
        /// <para>The field in the input table on which the join will be based.</para>
        /// <para>输入表中连接所基于的字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Join Field")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_field { get; set; }


        /// <summary>
        /// <para>Join Table</para>
        /// <para>The table to be joined to the input table.</para>
        /// <para>要联接到输入表的表。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Join Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _join_table { get; set; }


        /// <summary>
        /// <para>Join Table Field</para>
        /// <para>The field in the join table that contains the values on which the join will be based.</para>
        /// <para>连接表中包含连接所基于的值的字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Join Table Field")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _join_field { get; set; }


        /// <summary>
        /// <para>Transfer Fields</para>
        /// <para>The fields from the join table to be transferred to the input table, based on a join between the input table and the join table.</para>
        /// <para>基于输入表和连接表之间的连接，要传输到输入表的连接表中的字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Transfer Fields")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public List<object> _fields { get; set; } = null;


        /// <summary>
        /// <para>Updated Input Table</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Updated Input Table")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _out_layer_or_view { get; set; }


        public JoinField SetEnv(int? autoCommit = null, object workspace = null)
        {
            base.SetEnv(autoCommit: autoCommit, workspace: workspace);
            return this;
        }

    }

}